<template>
  <Card title="隐患排查统计">
    <div class="alarm-num">
      <div class="left">
        <RoundProgress
          ref="RoundProgress"
          title="隐患排查总数"
          color="#FF3F29"
        ></RoundProgress>
      </div>
      <div class="right">
        <RectNum
          :label="item.hidden_level"
          v-for="item in pieData"
          :value="item.count"
          line-color="#FF3F29"
          :key="item.hidden_level"
        ></RectNum>
      </div>
    </div>
    <div>
      <RectNum label="设备设施隐患" :border="false">
        <p style="font-size: 12px">
          已整改：{{
            equipment.complete
          }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;未整改：{{ equipment.notComplete }}
        </p>
      </RectNum>
      <RectNum label="作业活动隐患" :border="false">
        <p style="font-size: 12px">
          已整改：{{ task.complete }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;未整改：{{
            task.notComplete
          }}
        </p>
      </RectNum>
      <!-- <BarProgress :progress="83"></BarProgress> -->
    </div>
  </Card>
</template>

<script>
import { defineComponent } from "vue";

import Card from "./Card.vue";
import RectNum from "./RectNum.vue";
import RoundProgress from "./RoundProgress.vue";
import BarProgress from "./BarProgress.vue";

export default defineComponent({
  name: "HiddenDangerInvestigation",
  components: {
    Card,
    RectNum,
    RoundProgress,
    BarProgress,
  },
  data() {
    return {
      pieData: [],
      equipment: {
        complete: 0,
        notComplete: 0,
      },
      task: {
        complete: 0,
        notComplete: 0,
      },
    };
  },
  mounted() {},
  methods: {
    setData(data) {
      console.log(data);
      this.$refs.RoundProgress.render(data.total);
      this.pieData = data.level;
      this.equipment = data.equipment[0];
      this.task = data.task[0];
    },
  },
});
</script>

<style lang="scss" scoped>
.alarm-num {
  display: flex;
  align-items: center;

  .left {
    width: 50%;
  }

  .right {
    width: 50%;
  }
}

.chart {
  height: 200px;
}
</style>
